package ishaportalserver.apps;

import com.google.gson.Gson;

public class Utils {
	public static String addPaddingIfCallbackSpecified(String json, String callback) {		
		if (null != callback)
			json = callback + "(" + json + ")";
		
		return json;
	}
	
	public static String toJson(Object obj, String callback) {
		
		String json = new Gson().toJson(obj);		
		json = Utils.addPaddingIfCallbackSpecified(json, callback);
		
		return json;
	}
}
